from config import token
import requests


class userWithdrawRecord(object):

    #添加提现记录
    @classmethod
    def add_Withdraw(cls,json_data):
        url="http://kaxiaoli.kalulibattery.com/battery-admin-api/userWithdrawRecord/add"
        headers = {"x-access-token": token}
        resq = requests.post(url=url, headers=headers, json=json_data)
        return resq.json()

    # 查询所有提现记录
    @classmethod
    def select_Withdraw(cls, json_data):
        url = "http://kaxiaoli.kalulibattery.com/battery-admin-api/userWithdrawRecord/page/query"
        headers = {"x-access-token": token}
        resq = requests.post(url=url, headers=headers, json=json_data)
        return resq.json()

    # 通过ID查看详情
    @classmethod
    def select_Withdraw_id(cls, id):
        url = f"http://kaxiaoli.kalulibattery.com/battery-admin-api/userWithdrawRecord/detail/{id}"
        headers = {"x-access-token": token}
        resq = requests.get(url=url, headers=headers)
        return resq.json()

    # 修改提现记录表
    @classmethod
    def update_Withdraw(cls,json_data):
        url = f"http://kaxiaoli.kalulibattery.com/battery-admin-api/userWithdrawRecord/update"
        headers = {"x-access-token": token}
        resq = requests.post(url=url, headers=headers,json=json_data)
        return resq.json()

    # ID删除提现记录
    @classmethod
    def delete_Withdraw(cls,id):
        url = f"http://kaxiaoli.kalulibattery.com/battery-admin-api/userWithdrawRecord/delete/{id}"
        headers = {"x-access-token": token}
        resq = requests.get(url=url, headers=headers)
        return resq.json()

